home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / util / dir / managers.lha / Managers / Dir / Dir.view < prev    next >
Text File  |  1997-01-16  |  4KB  |  163 lines

  1. G4C  
  2.  
  3. ; This file contains a routine, to read the file selected according
  4. ; to it's type. You can add type checks here, to your heart's content.
  5.  
  6. ; The following variable has to be set beforehand
  7. ; FILENAME     <- Must contain the file to be viewed
  8. ;                 You MUST set this before calling the routine.
  9. ;                 Do NOT use it afterwards as it will be deleted.
  10.  
  11.  
  12. xRoutine ViewFile
  13. if $FILENAME < "  "            ; no variable..
  14.    return
  15. endif
  16. extract FILENAME file rtn.temp          ; see if it's a module
  17. cutvar  rtn.temp copy char 4 rtn.mod
  18. delvar  rtn.temp
  19. if $rtn.mod == mod.
  20.    run '$DEF.MOD $FILENAME'
  21.    delvar rtn.mod
  22.    return
  23. endif
  24.  
  25. docase $FILENAME
  26. case   H= "ã"                ; icon probably
  27.        copy $FILENAME ram:t        ; load gui which will show an icon
  28.        ifexists file ram:t/GCXX.info    ; named ram:t/GCXX.info
  29.             delete ram:t/GCXX.info
  30.        endif
  31.        extract FILENAME FILE rtn_info2
  32.        joinfile ram:t $rtn_info2 rtn_info
  33.        rename $rtn_info ram:t/GCXX.info
  34.        guiload :dir.icon
  35.        guiopen dir.icon
  36.        guiscreen dir.icon front
  37.        return
  38.        break
  39. case   H= "FORM????ILBM"        ; ILBM
  40.        cli '$rtn.option $DEF.ILBM >nil: $FILENAME'
  41.        return
  42.        break
  43. case   H= "FORM????ANIM"        ; Animation
  44.        cli '$rtn.option $DEF.ANIM >nil: $FILENAME'
  45.        return
  46.        break
  47. case   H= "GIF"                ; GIF
  48.        cli '$rtn.option $DEF.GIF >nil: $FILENAME'
  49.        return
  50.        break
  51. case   H= "??????JFIF"            ; JPEG
  52.        cli '$rtn.option $DEF.JPG >nil: $FILENAME'
  53.        return
  54.        break
  55. case   H= "FORM????8SVX"        ; 8svx Sound sample
  56.        cli '$rtn.option $DEF.8SVX >nil: $FILENAME'
  57.        return
  58.        break
  59. case   H= "PP"                ; PowerPacked file
  60.        run '$rtn.option $DEF.PP >nil: $FILENAME'
  61.        return
  62.        break
  63. case   H= G4C                ; Yes.. you guessed it.
  64.        GuiLoad $FILENAME
  65.        return
  66.        break
  67. case   H= ??-lh                ; LhA
  68.        cli 'Lha x $FILENAME ram:'
  69.        return
  70.        break
  71. case   H= "ZOO ?.??"            ; zoo
  72.        cli 'Zoo <* x// $FILENAME'
  73.        return
  74.        break
  75. case   H= ^Z                ; pkax
  76.        cli 'pkax -x $FILENAME'
  77.        return
  78.        break
  79. case   H= PK                ; unzip
  80.        cli 'unzip $FILENAME -d ram:'
  81.        return
  82.        break
  83. case   H= "@"                 ; Amigaguide (probably)
  84.        cli '$rtn.option $DEF.GUIDE $FILENAME'
  85.        return
  86.        break
  87. case   H= "%%%ó%"            ; A program ? - Use dir.cli to run it.
  88.        setvar cl_Main '$FILENAME '
  89.        GuiLoad :dir/dir.cli
  90.        GuiOpen dir.cli
  91.        GuiScreen dir.cli front
  92.        update  dir.cli 10 2        ; set it to RUN
  93.        setgad dir.cli 1 ON
  94.        return
  95.        break
  96. case   H= "????####"                    ; a text file (probably)
  97.        GuiLoad    :dir.read        ; damn thing doesn't recognise \n
  98.        guiopen    dir.read        ; as a printable character...
  99.        GuiWindow  dir.read FRONT    ; will change it for next version
  100.        GuiScreen  dir.read FRONT    ; of g4c
  101.        return
  102.        break
  103. endcase
  104.  
  105. ; If we got this far, let user decide what to do
  106. guiopen dir.gv
  107.  
  108.  
  109. ; ######################################################################
  110.  
  111. NEWFILE dir.gv       ; gui to decide what to do with unresolved files
  112.  
  113. WinBig 0 0 80 75 ""
  114. WinType 01001000
  115. winonmouse 40 10 
  116.  
  117. xOnRMB 
  118. guiclose dir.gv
  119.  
  120. xOnInactive
  121. guiclose dir.gv
  122.  
  123. xOnFail
  124. ezreq "Error during operation" OK ""
  125.  
  126. ;---------------> the Buttons
  127.  
  128. xbutton 0 0 0 15 MView
  129. guiclose dir.gv
  130. run '$DEF.MULTIVIEW $FILENAME'
  131.  
  132. xbutton 0 15 0 15 List
  133. GuiLoad    :dir.read        ; damn thing doesn't recognise \n
  134. guiopen    dir.read        ; as a printable character...
  135. GuiWindow  dir.read FRONT    ; will change it for next version
  136. GuiScreen  dir.read FRONT    ; of g4c
  137. return
  138. break
  139.  
  140. xbutton 0 30 0 15 Run
  141. guiclose dir.gv
  142. run '$FILENAME'
  143.  
  144. xbutton 0 45 0 15 With..
  145. guiclose dir.gv
  146. lv.run = ''
  147. ReqFile  -1 -1 300 220 'Run file with..' LOAD lv.run c:
  148. if $lv.run > ''
  149.    run '$lv.run $FILENAME'
  150. endif
  151. delvar lv.run
  152.  
  153. xbutton 0 60 0 15 'CliGui'
  154. guiclose dir.gv
  155. setvar cl_Main '$FILENAME '
  156. GuiLoad :dir/dir.cli
  157. GuiOpen dir.cli
  158. GuiScreen dir.cli front
  159. update  dir.cli 10 1        ; set it to CLI
  160. setgad dir.cli 1 ON
  161.  
  162.  
  163.